<template>
    <div class="person">
        <h2>姓名:{{name}}</h2>
        <h2>年龄:{{age}}</h2>
        <button @click="nameChange">更改姓名</button>
        <button @click="ageChange">增加年龄</button>
        <button @click="showTel">显示电话</button>
    </div>
</template>

<script lang="ts">
    export default {
        name: 'person'
        // setup(){
            // return {
            //     name,
            //     age,
            //     nameChange,
            //     ageChange,
            //     showTel
            // }
        // }
    }
</script>

<script lang="ts" setup>
    let name = '张三';
    let age = 18;
    let tel = '1888888888';

    function nameChange() {
        name = 'zhang-san'
    }

    function ageChange() {
        age += 1
    }

    function showTel() {
        alert(tel)
    }
</script>